import java.util.Scanner;

public class Question5 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入年份");
        int year = scanner.nextInt();
        System.out.println("请输入月份");
        int month = scanner.nextInt();
        System.out.println("请输入日期");
        int day = scanner.nextInt();
        //int sum = 0
        //switch (month){
        // .........
        // case 5:
        //     sum += 30;
        // case 4:
        //     sum += 31;
        // case 3:
        //     sum += 28;
        // if ((year%100!=0&&year%4=0)||year%400==0){
        // sum += 1
        // }
        // case 2:
        //     sum += 31;
        // case 1:
        //     sum += day;
        //     break;
        // System.out.println("第" + sum + "天");
        // }
        if (year % 100 != 0 && year % 4 == 0) {
            switch (month) {
                case 1:
                    System.out.println(day);
                    break;
                case 2:
                    System.out.println(day + 31);
                    break;
                case 3:
                    System.out.println(day + 60);
                    break;
                case 4:
                    System.out.println(day + 91);
                    break;
                case 5:
                    System.out.println(day + 121);
                    break;
                case 6:
                    System.out.println(day + 152);
                    break;
                case 7:
                    System.out.println(day + 182);
                    break;
                case 8:
                    System.out.println(day + 213);
                    break;
                case 9:
                    System.out.println(day + 244);
                    break;
                case 10:
                    System.out.println(day + 274);
                    break;
                case 11:
                    System.out.println(day + 305);
                    break;
                case 12:
                    System.out.println(day + 335);
                    break;
                default:
            }
        } else if (year % 100 == 0 && year % 400 == 0) {
            switch (month) {
                case 1:
                    System.out.println(day);
                    break;
                case 2:
                    System.out.println(day + 31);
                    break;
                case 3:
                    System.out.println(day + 60);
                    break;
                case 4:
                    System.out.println(day + 91);
                    break;
                case 5:
                    System.out.println(day + 121);
                    break;
                case 6:
                    System.out.println(day + 152);
                    break;
                case 7:
                    System.out.println(day + 182);
                    break;
                case 8:
                    System.out.println(day + 213);
                    break;
                case 9:
                    System.out.println(day + 244);
                    break;
                case 10:
                    System.out.println(day + 274);
                    break;
                case 11:
                    System.out.println(day + 305);
                    break;
                case 12:
                    System.out.println(day + 335);
                    break;
                default:
            }
        } else {
            switch (month) {
                case 1:
                    System.out.println(day);
                    break;
                case 2:
                    System.out.println(day + 31);
                    break;
                case 3:
                    System.out.println(day + 59);
                    break;
                case 4:
                    System.out.println(day + 90);
                    break;
                case 5:
                    System.out.println(day + 120);
                    break;
                case 6:
                    System.out.println(day + 151);
                    break;
                case 7:
                    System.out.println(day + 181);
                    break;
                case 8:
                    System.out.println(day + 212);
                    break;
                case 9:
                    System.out.println(day + 243);
                    break;
                case 10:
                    System.out.println(day + 273);
                    break;
                case 11:
                    System.out.println(day + 304);
                    break;
                case 12:
                    System.out.println(day + 334);
                    break;
                default:
            }
        }
    }

}
